package com.design;

import java.math.BigDecimal;

/**
 * 订单支付
 */
public class OrderPay {
    private Payment payment;

    public void setPayment(Payment payment) {
        this.payment = payment;
    }

    /**
     * 支付订单
     */
    public void payOrder(BigDecimal amount) {
        if (payment == null) {
            throw new IllegalArgumentException("支付方式不能为空");
        }
        payment.pay(amount);
    }
}
